/**
 *  基本模块
 */

const Koa = require('koa');
const app = new Koa();

const cors = require('koa2-cors');
const bodyParser = require('koa-bodyparser');



//-------------- my middlewares
const logger = require('./logger');
const router = require('./router');
const error = require('./error');
const monitor = require('./monitor');

app.use(error(app));
app.use(logger(app,'logger'));
app.use(monitor(app));

// cors
// bodyParser
app.use(cors());
app.use(bodyParser());


// route
app.use(router(app));


app.listen(3001,()=>{
   app.logger.defaultLogger.info('server start http://localhost:3001');
});

//
